namespace FrameworkBase
{
    public interface IModel : IBelongToArchitecture, ICanSetArchitecture
    {
        // 解决递归调用的生命周期方法
        void Init();
    }
    
    // 定义一个抽象类，解决样板代码的问题
    public abstract class AbstractModel : IModel
    {
        private IArchitecture _architecture;
        public IArchitecture GetArchitecture()
        {
            return _architecture;
        }

        public void SetArchitecture(IArchitecture architecture)
        {
            _architecture = architecture;
        }

        void IModel.Init() // 接口阉割
        {
            OnInit();
        }

        protected abstract void OnInit();
    }
}